import java.util.ArrayList;
import java.util.Collections;

public class Deck {
	Integer pl;
	ArrayList<String> list,grav;
	ArrayList<String> hand1, hand2,hand3,hand4,hand5, hand6;
	String [] tabdeck={"A:trefl","A:karo","A:pik", "A:kier",
			"2:trefl","2:karo","2:pik", "2:kier",
			"3:trefl","3:karo","3:pik", "3:kier",
			"4:trefl","4:karo","4:pik", "4:kier",
			"5:trefl","5:karo","5:pik", "5:kier",
			"6:trefl","6:karo","6:pik", "6:kier",
			"7:trefl","7:karo","7:pik", "7:kier",
			
			"8:trefl","8:karo","8:pik", "8:kier",
			"9:trefl","9:karo","9:pik", "9:kier",
			"10:trefl","10:karo","10:pik", "10:kier",
			"J:trefl","J:karo","J:pik", "J:kier",
			"D:trefl","D:karo","D:pik", "D:kier",
			"K:trefl","K:karo","K:pik", "K:kier",
	}; 
	String [] power={"A","2","3", "4","5", "6", "7", "8",  "9","J", "D", "K"};
   
	public Deck(Integer pl)
    { list = new ArrayList<String>();
      grav= new ArrayList<String>();
      hand1 = new ArrayList<String>();
      hand2= new ArrayList<String>();
      hand3 = new ArrayList<String>();
      hand4= new ArrayList<String>();
      hand5= new ArrayList<String>();
      hand6= new ArrayList<String>();
      this.pl=pl;
        for(int i=0; i<52; i++)
        { list.add(tabdeck[i]);}
        
       
        
        for(int i=0; i<5; i++)
        {Collections.shuffle(list);}
        
        
       
         
        Collections.shuffle(list);
       
       
    }
	
	
	public void plushand(Integer name)
	{   getlist(name).add(list.get(0));
	    list.remove(0);	
	}
	
	public String showcard(Integer name, Integer number)
	{   return getlist(name).get(number);
	}
	
	
	public void minushand(Integer name, String card)
	{   grav.add(card);
		getlist(name).remove(card);
		//getlist(name).remove(getlist(name).indexOf(card));
		if(grav.size()>=52)
    	{for(int i=0; i<12; i++)
        {Collections.shuffle(grav);}
    	list=grav;
    	grav.removeAll(grav);
    		
    	}
	}
    
   
    
    public ArrayList<String> getlist(Integer name)
    {  if(name==1 )return hand1;
    	else  if(name==2) return hand2;
    	else  if(name==3 && pl>=3) return hand3;
    	else  if(name==4 && pl>=4) return hand4;
    	else  if(name==5 && pl>=5) return hand5;
    	else  if(name==6 && pl>=6) return hand6;
    	else  if(name==7 ) return list;
    	else return grav;
        
    
       
    }
    
    
    
}